home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada,comp.lang.c++
- Path: news3.near.net!inmet!henning!stt
- From: stt@henning.camb.inmet.com (Tucker Taft)
- Subject: Re: on OO differnces between Ada95 and C++
- X-Nntp-Posting-Host: henning.camb.inmet.com
- Message-ID: <DnLIEx.M2C.0.-s@inmet.camb.inmet.com>
- Followup-To: comp.lang.ada,comp.lang.c++
- Sender: news@inmet.camb.inmet.com (USENET news)
- Organization: Intermetrics, Inc.
- X-Newsreader: TIN [version 1.1 PL8]
- References: <4h5ej5$168@wdl1.wdl.loral.com>
- Date: Fri, 1 Mar 1996 15:44:56 GMT
-
- Mark A Biggar (mab@dst17.wdl.loral.com) wrote:
- : >In article <DnDuA4.8GC@bton.ac.uk>, je@bton.ac.uk (John English) writes:
- : >Furthermore, for the convenience of its clients, X can contain a
- : >declaration such as
- : >
- : > subtype T is Y.T;
- : >
- : >which causes X to reexport the type originally declared in Y. Then X's
- : >client can refer to the type (as X.T) without a with clause for Y.
-
- : How does this interact with "use type T;"?
-
- Fine. "Use type" allows any subtype to be specified, and it
- makes the primitive operators of the subtype's type (the type
- "determined" by "T") directly visible. There really is no
- special case here, since only subtypes have names in Ada 95;
- even Y.T is a "subtype_mark."
-
- : Does the following work?
-
- Yes.
-
- : package A is
- : type T is new integer;
- : function "+"(L,R: T) return T;
- : end A;
-
- : with A;
- : package B is
- : subtype T is A.T;
- : end B;
-
- : with B;
- : procedure C is
- : X: B.T;
- : use type B.T;
- : begin
- : X := X + X; --- what "+" operator do I get here if any?
-
- The primitive "+" of the B.T's type, which is the one declared in
- package A.
-
- : end C;
-
- : Mark Biggar
- : mab@wdl.loral.com
-
- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/
- Intermetrics, Inc. Cambridge, MA USA
-